﻿using System.Windows;
using IntelligentStorWpfApp.Model;
using IntelligentStorWpfApp.Helper;
using WPFMediaKit.DirectShow.Controls;

namespace IntelligentStorWpfApp.View
{
    /// <summary>
    /// DefaultWindow.xaml 的交互逻辑
    /// </summary>
    public partial class DefaultWindow : Window
    {
        public DefaultWindow()
        {
            InitializeComponent();
            WindowStartupLocation = WindowStartupLocation.CenterScreen;
        }

        private void btnExit_Click(object sender, RoutedEventArgs e)
        {
            LogHelper.AddLog("退出登录");
            App.user = null;
            Login login = new Login();
            this.Close();
            login.Show();
        }

        private void btnCabinet_Click(object sender, RoutedEventArgs e)
        {
            CabinetWindow cabinetWin = new CabinetWindow();
            cabinetWin.ShowDialog();
        }

        private void btnInport_Click(object sender, RoutedEventArgs e)
        {
            InportProduct inportWin = new InportProduct();
            inportWin.ShowDialog();
        }

        private void btnSearch_Click(object sender, RoutedEventArgs e)
        {
            Search searchWin = new Search();
            searchWin.ShowDialog();
        }

        private void btnStatistics_Click(object sender, RoutedEventArgs e)
        {
            Statistics statisticsWin = new Statistics();
            statisticsWin.ShowDialog();
        }

        private void btnHistory_Click(object sender, RoutedEventArgs e)
        {
            OperationLogWin opLogWin = new OperationLogWin();
            opLogWin.ShowDialog();
        }

        private void btnCurrentUser_Click(object sender, RoutedEventArgs e)
        {
            ProductsData pDataWin = new ProductsData();
            pDataWin.ShowDialog();
        }
        private void btnInputFace_Click(object sender, RoutedEventArgs e)
        {
            if (MultimediaUtil.VideoInputNames.Length <= 0)
            {
                MessageBox.Show("电脑没有安装任何摄像头", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }
            FaceIdentify winFaceIdentify = new FaceIdentify();
            winFaceIdentify.ShowDialog();
        }
    }
}
